
import { ShareInfo } from "../const/enumConst";
import { Native_Operation, NativePlatform } from "./nativePlatform";
import { App } from "../../../src/app";
import { EventName } from "../const/eventName";

export class IosPlatform extends NativePlatform {

    getUUid(): string {
        return '';
    }

    changeOrientation(isPortrait: boolean) {
        super.changeOrientation(isPortrait);
        // jsb.reflection.callStaticMethod("JsClass", "changeOrientation:", isPortrait);
    }

    savePictureToAlbum(data: string) {
    }
    copyToClipboard(content: string): void {
    }
    getClipboardContent(): Promise<string> {
        return new Promise(r => { r('') });
    }
    getPackageName(): Promise<string> {
        return new Promise(r => { r('') });
    }
    getAppVersion(): string {
        return '';
    }
    checkIsEmulator(): boolean {
        return false;
    }

    sendNativeMsg(operation: string, args: string) {
        // native.bridge.sendToNative(operation, args);
    }
    
    receiveNativeMsg(operation: string, data: string) {
        switch (operation) {
            case Native_Operation.CheckIsEmulator://是否是模拟器
                if (!+data) {//禁止在模拟器上运行
                    cc.game.end();
                }
                break;

            case Native_Operation.UserInfo:
                App.event.emit(EventName.Game.USER_INFO, data);
                break;

            case Native_Operation.LeaveRoom:
                App.event.emit(EventName.Game.NATIVE_LEAVE_ROOM, data);
                break;

            case Native_Operation.PlayerTalk:
                App.event.emit(EventName.Game.NATIVE_PLAYER_TALK, data);
                break;

            default:
                break;
        }
    }


    faceBookLogin(): string {
        return "";
    }

    faceBookLoginOut(): boolean {
        return false;
    }

    loginGoogle(): string {
        return ""
    }

    loginOutGoogle(): boolean {
        return false
    }

    faceBookShare(content: ShareInfo) {
        return false;
    }

    whatsAppShare(url: string) {
        return false;
    }
}